import React, { Component } from 'react'
import KeepAlive from 'react-activation'

export const alive = function (Constructor: any): any {
  const { name } = Constructor

  return () => (
    <KeepAlive cacheKey={name}>
      <Constructor />
    </KeepAlive>
  )
}
